<?php
            $link = array();
            $link[0] = "http://www.webhostingtalk.com/showthread.php?t=703139";
            $link[1] = "https://www.coursera.org/";
            $link[2] = "http://stackoverflow.com/questions/5683988/in-php-if-i-find-a-word-in-a-file-can-i-make-the-line-that-the-word-came-from";
            $link[3] = "http://www.daniweb.com/web-development/php/threads/316812/how-to-find-some-specific-word-in-a-text-file-using-php";
            $link[4] = "http://php.bigresource.com/search-for-a-specific-word-inside-a-text-file--GDlta0hJ.html";
            $link[5] = "http://www.coderanch.com/forums";
            $link[6] = "http://www.learningtree.com/training-directory/Java-Training-5.htm";
    
            foreach ($link as $url){
        
            $page = file_get_contents($url);
                $page = strtolower($page);
            echo $url."</br>";
                //$pattern  = '/\bjava\b/i';
                $coursename_count = substr_count($page, 'java ');
                
            
            
            echo $coursename_count."</br>";
            $training_count = substr_count($page,'training');
            echo $training_count."</br>";
            $course_count = substr_count($page,'course');
            echo $course_count."</br>";
        
            if ( $coursename_count >1 AND $training_count >1 AND $course_count >1){
            
                echo "is a valid link"."</br>";
            }
            else{
                echo "invalid link"."</br>";
            }
                
            }
            
    ?>
        

